package com.copa.l2042;

/**
 * @author copa
 * @createDate 2023-01-03 9:31
 * @function 一次遍历法
 */
public class Test1 {

    public boolean areNumbersAscending(String s) {
        String[] tokenArray = s.split(" ");
        int result = -1;
        for (String token : tokenArray) {
            if (token.charAt(0) > '0'  && token.charAt(0) <= '9') {
                int num = Integer.parseInt(token);
                if (num <= result) {
                    return false;
                }
                result = num;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        String s = "1 box has 3 blue 4 red 2 green and 12 yellow marbles";
        System.out.println(new Test1().areNumbersAscending(s));
    }
}
